package io.github.javpower.knowledgerag.core;

import java.io.IOException;
import java.util.List;

public class DocumentReader {
    public static List<String> readAndChunkDocument(String filePath, int chunkSize) {
        // 读取文档内容
        String documentContent = null;
        try {
            documentContent = Tokenizer.readDocument(filePath);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        // 综合分块方法
        List<String> blocks = new HybridBlockSplitter().split(documentContent, chunkSize);
        System.out.println("Blocks: " + blocks.size());
        blocks.forEach(System.out::println);
        return blocks;
//        try {
//            return Tokenizer.readLine(filePath);
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
    }
}